/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;


/**
 *
 * @author A0077454
 */
@Entity
public class SalesOrder implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long SaleOrderId;
    @OneToMany(cascade = {CascadeType.PERSIST})
    private List<SalesItem> saleItems = new ArrayList();
    @OneToOne(cascade = {CascadeType.PERSIST})
    private PurchaseOrder purchaseOrder;
    @OneToMany(cascade = {CascadeType.PERSIST})
    private List<BackOrder> backOrder = new ArrayList();
    @OneToMany(cascade = {CascadeType.PERSIST})
    private List<DeliveryOrder> deliveryOrder = new ArrayList();
    @OneToMany(cascade = {CascadeType.PERSIST})
    private List<ProductInventory> productInventory = new ArrayList();
    @OneToOne(cascade = {CascadeType.PERSIST})
    private SystemUser createdBy;
    @OneToOne(cascade = {CascadeType.PERSIST})
    private Address companyAddress;
    private String orderNum;
    private Date createdDate;
    private Date deliveryDate;
    private String contactPerson;
    private String salutation;
    private String email;
    private String phone;
    private Integer gst;
    private String additionalChargeDesc;
    private Double additionalCharge;
    private String additionalChargeType;
    private String transportChargeType;
    private Double transportCharge;
    private String saleTerm;
    private String status;
    private String remark;

    public SalesOrder() {
    }

    public void create(String orderNum, String contactPerson, Date deliveryDate, String salutation, String email, String phone, Integer gst, String additionalChargeDesc, String additionalChargeType, Double additionalCharge, String transportChargeType, Double transportCharge, String status, String saleTerm,String remark, Date createdDate) {
        this.orderNum = orderNum;
        this.contactPerson = contactPerson;
        this.salutation = salutation;
        this.email = email;
        this.phone = phone;
        this.gst = gst;
        this.additionalChargeDesc = additionalChargeDesc;
        this.additionalCharge = additionalCharge;
        this.additionalChargeType = additionalChargeType;
        this.transportChargeType = transportChargeType;
        this.transportCharge = transportCharge;
        this.status = status;
        this.remark = remark;
        this.saleTerm = saleTerm;
        this.deliveryDate = deliveryDate;
        this.createdDate = createdDate;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
    
    

    public Double getAdditionalCharge() {
        return additionalCharge;
    }

    public Address getCompanyAddress() {
        return companyAddress;
    }

    public void setCompanyAddress(Address companyAddress) {
        this.companyAddress = companyAddress;
    }

    public String getContactPerson() {
        return contactPerson;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getDeliveryDate() {
        return deliveryDate;
    }

    public void setDeliveryDate(Date deliveryDate) {
        this.deliveryDate = deliveryDate;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSalutation() {
        return salutation;
    }

    public void setSalutation(String salutation) {
        this.salutation = salutation;
    }

    public void setAdditionalCharge(Double additionalCharge) {
        this.additionalCharge = additionalCharge;
    }

    public String getAdditionalChargeDesc() {
        return additionalChargeDesc;
    }

    public void setAdditionalChargeDesc(String additionalChargeDesc) {
        this.additionalChargeDesc = additionalChargeDesc;
    }

    public String getAdditionalChargeType() {
        return additionalChargeType;
    }

    public void setAdditionalChargeType(String additionalChargeType) {
        this.additionalChargeType = additionalChargeType;
    }

    public Integer getGst() {
        return gst;
    }

    public void setGst(Integer gst) {
        this.gst = gst;
    }

    public String getSaleTerm() {
        return saleTerm;
    }

    public void setSaleTerm(String saleTerm) {
        this.saleTerm = saleTerm;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Double getTransportCharge() {
        return transportCharge;
    }

    public void setTransportCharge(Double transportCharge) {
        this.transportCharge = transportCharge;
    }

    public String getTransportChargeType() {
        return transportChargeType;
    }

    public void setTransportChargeType(String transportChargeType) {
        this.transportChargeType = transportChargeType;
    }

    public Long getSaleOrderId() {
        return SaleOrderId;
    }

    public void setSaleOrderId(Long SaleOrderId) {
        this.SaleOrderId = SaleOrderId;
    }

    public SystemUser getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(SystemUser createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public PurchaseOrder getPurchaseOrder() {
        return purchaseOrder;
    }

    public void setPurchaseOrder(PurchaseOrder purchaseOrder) {
        this.purchaseOrder = purchaseOrder;
    }

    public List<BackOrder> getBackOrder() {
        return backOrder;
    }

    public void setBackOrder(List<BackOrder> backOrder) {
        this.backOrder = backOrder;
    }

    public List<DeliveryOrder> getDeliveryOrder() {
        return deliveryOrder;
    }

    public void setDeliveryOrder(List<DeliveryOrder> deliveryOrder) {
        this.deliveryOrder = deliveryOrder;
    }

    public List<ProductInventory> getProductInventory() {
        return productInventory;
    }

    public void setProductInventory(List<ProductInventory> productInventory) {
        this.productInventory = productInventory;
    }

    public List<SalesItem> getSaleItems() {
        return saleItems;
    }

    public void setSaleItems(List<SalesItem> saleItems) {
        this.saleItems = saleItems;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (SaleOrderId != null ? SaleOrderId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalesOrder)) {
            return false;
        }
        SalesOrder other = (SalesOrder) object;
        if ((this.SaleOrderId == null && other.SaleOrderId != null) || (this.SaleOrderId != null && !this.SaleOrderId.equals(other.SaleOrderId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Sale_Order[ id=" + SaleOrderId + " ]";
    }
}
